<%@ page language="java" import="java.util.*,com.beans.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"+ request.getServerName() + ":" + request.getServerPort()+ path + "/";
%>
<!DOCTYPE HTML>
<html>
	<head>
		<base href="<%=basePath%>">
		<title>选择支付方式</title>
		<link href="css/basestyle.css" rel="stylesheet" type="text/css">
	</head>
<body >
<div id="div_content">
	<%@ include file="../top.jsp"%>
	 <%
	 		String trueName=request.getParameter("trueName");
	 	 	trueName=new String(trueName.getBytes("iso8859-1"),"utf-8");
	 	 	
	 	 	String postMethod=request.getParameter("postMethod");
	 	 	postMethod=new String(postMethod.getBytes("iso8859-1"),"utf-8");
	 	 	
	 	 	String address=request.getParameter("address");
	 	 	address=new String(address.getBytes("iso8859-1"),"utf-8");
	 	 	
	 	 	//计算出商品总价 			
	 	    Map<Integer,ShopCart> shopCartMap=(Map<Integer,ShopCart>)session.getAttribute("shopCartMap");
	 	    float totalMoney=0;
	 		Collection<ShopCart> cartList=shopCartMap.values();
	 		Iterator<ShopCart>it=cartList.iterator();
	 		while(it.hasNext()){
	 	ShopCart s=it.next();
	 	totalMoney+=s.getGoodsPrice()*s.getGoodsNumber();
	 		}
	 		
	 		//根据用户选的是平邮还是快递,计算出运费
	 		float postage=0;
	 		if("平邮".equals(postMethod)){
	 		postage=10;
	 		}
	 		else if("快递".equals(postMethod)){
	 		postage=15;
	 		}
	 %>

		<table  id="maintable" >
			<tr>
				<td>
					&nbsp;
				</td>
				<td>
				<form name="f1" action="${pageContext.request.contextPath }/OrderServlet?flag=geneOrder" 	method="post">
				  <input type="hidden" name="trueName" value='<%=trueName %>' />
				  <input type="hidden" name="address" value='<%=address %>'/> 
				  <input type="hidden" name="postMethod" value='<%=postMethod %>' />
				  <input type="hidden" name="phone" value='${param.phone}' />
				  <input type="hidden" name="zipCode" value='${param.zipCode}' />
	  
					<table width="100%" border="0" cellpadding="0" cellspacing="0">
						<tr>
							<td height="60">
								<img src="images/zhifuguanli.gif" />
							</td>
						</tr>
						<tr>
							<td>
								<table cellspacing="0" cellpadding="0" border="0">
									<tr valign="middle">
										<td>
											<img hspace="5" src="images/Car_07.gif" />
										</td>
										<td class="carbg_default">
											查看购物车物品
										</td>
										<td>
											<img height="39" src="images/Car_15.gif" width="1" />
										</td>
										<td align="center">
											<img hspace="5" src="images/Car_09.gif" />
										</td>
										<td class="carbg_default">
											填写用户邮递地址
										</td>
										<td>
											<img height="39" src="images/Car_15.gif" width="1" />
										</td>
										<td align="center">
											<img hspace="5" src="images/Car_09.gif" />
										</td>
										<td class="carbg_current">
											选择付款方式
										</td>
										<td>
											<img height="39" src="images/Car_15.gif" width="1" />
										</td>
										<td align="center">
											<img hspace="5" src="images/Car_11.gif" />
										</td>
										<td class="carbg_default">
											订单提交成功
										</td>
										<td>
											<img height="39" src="images/Car_15.gif" width="1" />
										</td>
									</tr>
								</table>
							</td>
						</tr>
		
						<tr>
							<td height="39" align="center">
								<table cellspacing="1" cellpadding="0" width="82%" border="0"
									bgcolor="#F7F3F7">
									<tr height="26" >
										<td width="48%" height="35" align="center" class="order_total" colspan="2">
											<input type="hidden" name="postMethod" value="${postMethod}" />
											 
												<span id="totalMoney">商品总价:&nbsp;<%=totalMoney %> 邮费:&nbsp;<%=postage %></span>&nbsp;&nbsp;&nbsp; 合计:<img hspace="5" src="images/me03.gif" /><%=totalMoney+postage %> 元		
										</td>
									
									</tr>
									<tr height="26">
										<td width="48%" height="35" align="center" class="text">
											<input  style="magging-left:300px" type="radio" name="paymentMethod" value="邮局汇款"
												checked="checked" />
											邮局汇款
										</td>
										<td width="52%" align="center" class="text">
											<input type="radio" name="paymentMethod" value="网上银行转账" />
											网上银行转账
										</td>
									</tr>
									<tr height="26">
										<td width="48%" height="35" align="center" class="text">

										</td>
									</tr>
								</table>
							</td>
						</tr>
						<tr height="20">
							<td colspan="5"></td>
						</tr>
						<tr align="right">
							<td align="center">
								<a href="javascript:history.go(-1)"><img
										border="0" src="images/Car_icon_back.gif" />
								</a>
							
								<a onclick="if(confirm('确定提交吗')) document.f1.submit()">
								  <img src="images/Car_icon_06.gif"  />
								</a>

							</td>
						</tr>
						<tr align="right">
							<td height="20">
								&nbsp;
							</td>
						</tr>
					</table>
				 </form>
				</td>
			</tr>
		</table>
			<%@ include file="../bottom.jsp"%>
		</div>
	</body>
</html>

